package dxbridge.model;


import org.dom4j.Element;

public interface IRecord {

    /**
     * Get the XPath that can be used to identify this exact record in Allora
     * format data xml file.
     * 
     * @return The xpath String.
     */
    public abstract String getXPath();

    /**
     * Judge if two record are same in key field values.
     * 
     * @param anotherRecord
     * @return
     */
    public abstract boolean isKeyFieldValuesEqual(IRecord anotherRecord);

    /**
     * Judge if two record is exactly same, that means is belong to same table,
     * and all values are exactly same.
     * 
     * @param anotherRecord
     *            Record to compare with.
     * @return If this record is same as the other one.
     */
    public abstract boolean equals(Object record);

    /**
     * Get a Dom4j XML Element, converted by this Record, should be like :
     * 
     * <pre>
     *   &lt;table_name&gt;
     *      &lt;field1&gt;value1&lt;/field1&gt;
     *      &lt;field2&gt;value2&lt;/field2&gt;
     *   &lt;/table_name&gt;
     *</pre>
     * 
     *!!Difference from that read directly from Allora format data xml is that,
     * it do not contains the sub-record.
     * 
     * @return XML Element format of this record.
     */
    public abstract Element toXMLElement();

    /**
     * Get the value for a given field
     * 
     * @param fieldName
     * @return The value of the specified field.
     */
    public abstract String getValueForField(String fieldName);

    /**
     * Get a String represent this unique record to register into "urn_detail"
     * field in GNR database. That is key values separated by '/'
     * 
     * @return The gnrString
     */
    public abstract String getGNRString();

    public abstract ITable getTable();

    public abstract void setTable(ITable table);

    public abstract String[] getValues();

    public abstract void setValues(String[] values);

    public abstract void printTest();

    public abstract String toString();

}